import com.sun.javafx.Logging;
import org.junit.Test;

/**
 * Created by didi on 30/05/2018.
 */
public class TestApplicationClassLoader {

    /**
     *
     * 三个默认类加载器
     * @param args
     */
    public static void main(String[] args) {
        System.out.println("三种类加载器加载3个位置的类");
        System.out.println(Integer.class.getClassLoader()); //lib包  //获取Bootstrap类加载器永远返回null值
        System.out.println(Logging.class.getClassLoader());//ext包
        System.out.println(TestApplicationClassLoader.class.getClassLoader());//classpath

        System.out.println("3种类加器的继承关系");
        System.out.println(TestApplicationClassLoader.class.getClassLoader());//应用程序类加载器: AppClassLoader
        System.out.println(TestApplicationClassLoader.class.getClassLoader().getParent());//扩展类加载器: ExtClassLoader
        System.out.println(TestApplicationClassLoader.class.getClassLoader().getParent().getParent());//启动类加载器:c++编写,不能获取到: null
    }
    @Test
   public void f(){
       ClassLoader clazz = this.getClass().getClassLoader();
        System.out.println(clazz);
    }

    @Test
    public void f2(){
        ClassLoader clazz = ClassLoader.getSystemClassLoader();
        System.out.println(clazz);
    }
}
